-
Notifications
You must be signed in to change notification settings - Fork 13
WDK Core Documentation Refactor #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
WDK Core Documentation Refactor #64
Conversation
lucas-tortora
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful PR :) Just a few comments regarding style and structure.
| {% endcode %} | ||
|
|
||
| {% hint style="info" %} | ||
| The WDK instance caches accounts. calling `getAccount` twice for the same index returns the same object instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The WDK instance caches accounts. calling `getAccount` twice for the same index returns the same object instance. | |
| The WDK instance caches accounts. If you call `getAccount` twice using the same index, the function will return the same `Account` object instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {% hint style="warning" %} | ||
| **Network Mismatch Warning** | ||
| Ensure your WDK instance configuration matches your account environment. | ||
| * If using **Testnet** keys, ensure you registered the wallet with a **Testnet RPC**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add links to the RPCs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Ensure your WDK instance configuration matches your account environment. | ||
| * If using **Testnet** keys, ensure you registered the wallet with a **Testnet RPC**. | ||
| * If using **Mainnet** keys, ensure you registered the wallet with a **Mainnet RPC**. | ||
| Using a Mainnet key on a Testnet RPC (or vice versa) will result in "Network not allowed" or 0 balance errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Using a Mainnet key on a Testnet RPC (or vice versa) will result in "Network not allowed" or 0 balance errors. | |
| Using a Mainnet key on a Testnet RPC (or vice versa) will result in "Network not allowed" or zero balance errors. |
We should spell out numbers unless they are being used in opertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| ## View Addresses | ||
|
|
||
| Once you have an account object, you can retrieve its public blockchain address. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Once you have an account object, you can retrieve its public blockchain address. | |
| Once you have an account object, you can retrieve its public blockchain address using the `getAddress` function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| ## Check Balances | ||
|
|
||
| You can check the native token balance of any account (e.g., ETH on Ethereum, TON on TON). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You can check the native token balance of any account (e.g., ETH on Ethereum, TON on TON). | |
| You can check the native token balance of any account (e.g., ETH on Ethereum, TON on TON) by using the `getBalance()` function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Multi-Chain Transactions | ||
|
|
||
| You can orchestrate payments across different chains in a single function by acting on multiple account objects sequentially. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The following example will: | |
| 1. Retrieve an ETH and ton account using the `getAccount()` method. | |
| 2. Send ETH and `await` the transaction. | |
| 3. Send TON and `await` the transaction. |
| npm install @tetherto/wdk-wallet-evm @tetherto/wdk-wallet-ton @tetherto/wdk-wallet-btc | ||
| ``` | ||
|
|
||
| ## Example: Registering Multiple Wallets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Example: Registering Multiple Wallets | |
| ## Register Multiple Wallets |
|
|
||
| ## Installation | ||
|
|
||
| Install the wallet managers for the blockchains you want to support: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add link to the wallet modules home page.
| ``` | ||
|
|
||
| ## Example: Registering Multiple Wallets | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### Import the Wallet Manager Packages | |
| ``` | ||
| {% endcode %} | ||
|
|
||
| Then, instantiate WDK and chain the registration calls: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Then, instantiate WDK and chain the registration calls: | |
| ### Register the Wallets | |
| Then, instantiate WDK and chain the registration calls: |
Please add link to the instantiate doc
lucas-tortora
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful PR :) Just a few comments regarding style and structure.
| * [All Modules](sdk/all-modules.md) | ||
| * [Core Module](sdk/core-module/README.md) | ||
| * [Usage](sdk/core-module/usage.md) | ||
| * [Installation](sdk/core-module/guides/installation.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge installation and Instantiation into one.
Installation does not provide enough value.
Also use a more readable name like "Get Started" or similar
|
|
||
| ### Parameters | ||
|
|
||
| The `registerWallet` method requires three arguments: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link to the method in reference page? or maybe a note saying "See full reference here"
| provider: 'https://eth.drpc.org' | ||
| }) | ||
| // 2. Register TON | ||
| .registerWallet('ton', WalletManagerTon, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove Ton. Just because it's the only one that needs an API key to use, so a user cannot copy the snippet and run without configuration.
So leave only 2 modules in this example or add another wallet module that doesn't require API KEY
| * **Mainnet:** `https://eth.drpc.org` | ||
| * **Sepolia (Testnet):** `https://sepolia.drpc.org` | ||
| {% endhint %} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot promote specific RPCs. Maybe instead we should create a section in the "Concepts" page where we tell developers some RPCs for each network and tell them where to find more (https://chainlist.org) - Leaving the choice to developers
Here we can create a hint like "Find out more about RPCs here" or something
| {% endcode %} | ||
|
|
||
| {% hint style="info" %} | ||
| **Get Testnet Funds:** To test these transactions without spending real money, verify you are on a testnet and use a faucet: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe section in the concepts page about testing funds, where to get them, what are available faucets etc.
|
|
||
| ## Handling Responses | ||
|
|
||
| The `sendTransaction` method returns a transaction result object. The most important field is typically `hash`, which represents the transaction ID on the blockchain. You can use this hash to track the status of your payment on a block explorer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link "transaction result object" to the reference page?
| ``` | ||
| {% endcode %} | ||
|
|
||
| ### Account-Level Registration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this section, as this is the guide for the core module not specific accounts / wallets
sdk/core-module/guides/middleware.md
Outdated
| ``` | ||
| {% endcode %} | ||
|
|
||
| ## Failover Protection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @tetherto/wdk-provider-failover wraps a specific wallet module, not the core, so maybe we should remove this guide from core module documentation and move to another section ?
…es, and improved headers
This PR refactors the monolithic sdk/core-module/usage.md into 8 granular "How-to" guides.
This refactor was validated using a "User Zero" approach: verification was performed by explicitly following the newly created guides step-by-step from a fresh state to ensure accuracy and reproducibility. During this process, several critical gaps and inaccuracies were identified and resolved.
Resolved Issues
1. Replaced Unavailable TON Bridge
@tetherto/wdk-protocol-bridge-usdt0-tonis not available on NPM.@tetherto/wdk-protocol-bridge-usdt0-evmpackage in protocol-integration.md.2. Corrected Failover Middleware
@tetherto/wdk-wrapper-failover-cascadewere incorrect (404).@tetherto/wdk-provider-failoverwith the correctcreateFallbackWalletwrapper pattern (moved out ofregisterMiddleware).Corrections & Value Additions
2. Configuration Corrections (TON)
tonApiKey,tonApiEndpoint) but the SDK requires a nestedtonClientobject.https://t.me/toncenter) and their docs (https://docs.ton.org/...) in guides/wallet-registration.md.3. Functional Verification Fixes
npm installsteps for wallet and protocol packages.UQCz5ON7jj...).4. Visual & Style Improvements
{% hint style="info" %}) for consistent rendering.File Changes
sdk/core-module/guides/*.mdcreateFallbackWalletwrapper pattern)Verification Report
@tetherto/wdksuccessfully.registerMiddleware).dispose()functionality.